import {get} from '@/utils/request'
export default {
  namespaced: true,
  state: {
    categoryData:[]
  },
  mutations: {
      //接收栏目数据
      SET_CATEGORYDATA(state,payload){
        //将Actions中传递过来的数据赋值给state中对应的变量
        state.categoryData = payload
      }
    
  },
  actions: {
    //{commit} 代替context成为actions方法中的一个参数
    //直接通过commit('mutations方法名'，要传递的数据)

    //分页查询所有栏目数据
    async getAllCategoryData({commit},payload){
        let res = await get('/productCategory/pageQuery',payload)
        commit('SET_CATEGORYDATA',res.data.list)
    },
    /**
     * @description: 分页查询顾客信息
     * @param {*} commit
     * @param {*} payload
     * @return {*}
     */
    async pageQueryCustome({ commit }, payload) {
      const res = await pageQuery(payload)
      commit('SET_CUSTOMES', res.data.list)
      commit('SET_CUSTOME_TOTAL', res.data.total)
    }
  }
}

